package com.aliwo.pubLisher;

import com.aliwo.event.MyTestEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

/**
 * 事件发布.
 *
 * @author Xu Yayuan
 */
@Component
public class MyTestEventPubLisher {
    @Autowired
    private ApplicationContext applicationContext;

    /**
     * @param msg 消息
     *            事件发布方法
     */
    public void pushListener(String msg) {
        applicationContext.publishEvent(new MyTestEvent(this, msg));
    }
}
